package com.campus.common.message;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 订单完成消息
 * 用于Kafka消息传递，从商户端/配送端发送到顾客端
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderCompleteMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户openId
     */
    private String openId;

    /**
     * 订单号
     */
    private String orderId;

    /**
     * 货品名称（商品列表的简要描述）
     */
    private String goodsName;

    /**
     * 订单金额
     */
    private BigDecimal orderAmount;

    /**
     * 完成时间
     */
    private String completeTime;

    /**
     * 订单备注
     */
    private String remark;

    /**
     * 消息创建时间戳
     */
    private Long timestamp;

    /**
     * 构造方法（不包含时间戳，自动设置为当前时间）
     */
    public OrderCompleteMessage(String openId, String orderId, String goodsName, BigDecimal orderAmount, String completeTime, String remark) {
        this.openId = openId;
        this.orderId = orderId;
        this.goodsName = goodsName;
        this.orderAmount = orderAmount;
        this.completeTime = completeTime;
        this.remark = remark;
        this.timestamp = System.currentTimeMillis();
    }
}